package response

import (
	"encoding/json"
	"net/http"
	"strconv"

	defs "github.com/lierdan/golangweb/internal/defs"
)

// ERROR
func SendErrorResponse(w http.ResponseWriter, errResp defs.ErrResponse) {
	w.WriteHeader(errResp.HttpSc)
	bytes, _ := json.Marshal(errResp.Error)
	w.Write(bytes)
}

// NORMAL
func SendNormalResponse(w http.ResponseWriter, msg string, status int) {
	w.Write([]byte(msg + strconv.Itoa(status)))
}
